<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Class to select all existing requests
	*/
	class CommandSelectUsers extends CustomCommand {
		/*
		 * Constructor of the class
		 */
		public function __construct() {
				
		}
		
		/*
		 * Method to execute to select all existing users
		 */
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$irad = $daoFactory -> getMySqlUserAccessDao();			
			$sentence = $irad -> selectUsers();
			
			$users = ''; $i = 0;
			while ($row = mysql_fetch_array($sentence)) {
				$users['pk_username'][$i] = $row['pk_username'];
				$users['first_name'][$i] = $row['first_name'];
				$users['second_name'][$i] = $row['second_name'];
				$users['first_last_name'][$i] = $row['first_last_name'];
				$users['second_last_name'][$i] = $row['second_last_name'];
				$users['email_address'][$i++] = $row['email_address'];
			}			
				$GLOBALS['debug']->log('Funcion que llama al DAO');
			$this -> result = $users;
		}
	}
?>